package com.example.jimanguang.web.models;

public class ApiResult {//前后端统一返回数据格式
    private final  boolean success;//获取是否成功
    private final String message;//成功和失败的消息数据
    private final Object data;//数据库对象
    //通过构造器注入,都起到了封装和返回数据的作用
    public ApiResult(boolean success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = data;
    }
    public boolean isSuccess() {
        return success;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }

    @Override
    public String toString() {
        return "ApiResult{" +
                "success=" + success +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
